<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
		    <li><a href="{:url('cloud/index')}">个人信息</a></li>
            <li><a href="{:url('cloud/goodsindex')}">商品列表</a></li>
            <li><a href="{:url('cloud/storaindex')}">仓库列表</a></li>
            <li class="active"><a href="###">余额明细</a></li>
		</ul>
		
		<form method="post" class="js-ajax-form" >
			<div class="row">
				<table class="table table-hover table-bordered table-striped table-condensed">
					<thead>
					<tr>
						<th>时间</th>
						<th>数量</th>
						<th>描述</th>
						<th>备注</th>
					</tr>
					</thead>
					<tbody>
				    <?php if ($list['data']) { ?>
					<?php foreach($list['data'] as $vo) { ?>
						<tr>
							<td>{$vo.createtime ? date('Y/m/d H:i', $vo.createtime) : '-'}</td>
							<td>{$vo.money}</td>
							<td>{$vo.reason}</td>
							<td>{$vo.memo}</td>
						</tr>
					<?php } ?>
					<?php } else { ?>
					<tr>
						<td colspan="4">
						    暂无数据
						</td>
					</tr>
					<?php } ?>
					</tbody>
				</table>
				
				<?php if ($list['data']) { ?>
				<div class="pagination">
				    <?php $side = 3; $window = $side * 2; $link = '/admin/cloud/logs.html?page='; ?>
				    <li class="page-item {$list['current_page'] == 1 ? 'disabled active' : ''}">
				        <a class="page-link" href="{$list['current_page'] == 1 ? '###' : $link.($list['current_page']-1)}">«</a>
			        </li> 
				    <li class="page-item {$list['current_page'] == 1 ? 'disabled active' : ''}">
				        <a class="page-link" href="{$list['current_page'] == 1 ? '###' : $link.'1'}">1</a>
				    </li>
				    <?php if ($list['last_page'] < $window + 6) { ?>
    				    <?php for ($i = 2; $i <= $list['last_page']; $i ++) { ?>
    			            <li class="page-item {$list['current_page'] == $i ? 'disabled active' : ''}">
    			                <a class="page-link" href="{$list['current_page'] == $i ? '###' : $link.$i}">{$i}</a>
    			            </li>
    			        <?php } ?>
				    <?php } else if ($list['current_page'] <= $window) { ?>
				        <?php for ($i = 2; $i < $window + 2; $i ++) { ?>
				            <li class="page-item {$list['current_page'] == $i ? 'disabled active' : ''}">
    			                <a class="page-link" href="{$list['current_page'] == $i ? '###' : $link.$i}">{$i}</a>
    			            </li>
				        <?php } ?>
				        <li class="disabled"><span>...</span></li>
				        <?php for ($i = ($list['last_page'] - 1); $i <= $list['last_page']; $i ++) { ?>
				            <li class="page-item {$list['current_page'] == $i ? 'disabled active' : ''}">
    			                <a class="page-link" href="{$list['current_page'] == $i ? '###' : $link.$i}">{$i}</a>
    			            </li>
				        <?php } ?>
				    <?php } else if ($list['current_page'] > ($list['last_page'] - $window)) { ?>
				        <?php for ($i = 2; $i <= 2; $i ++) { ?>
				            <li class="page-item {$list['current_page'] == $i ? 'disabled active' : ''}">
    			                <a class="page-link" href="{$list['current_page'] == $i ? '###' : $link.$i}">{$i}</a>
    			            </li>
				        <?php } ?>
				        <li class="disabled"><span>...</span></li>
				        <?php for ($i = ($list['last_page'] - ($window + 2)); $i <= $list['last_page']; $i ++) { ?>
				            <li class="page-item {$list['current_page'] == $i ? 'disabled active' : ''}">
    			                <a class="page-link" href="{$list['current_page'] == $i ? '###' : $link.$i}">{$i}</a>
    			            </li>
    			         <?php } ?>   
			        <?php } else { ?>
			            <?php for ($i = 2; $i <= 2; $i ++) { ?>
		    		        <li class="page-item {$list['current_page'] == $i ? 'disabled active' : ''}">
        			            <a class="page-link" href="{$list['current_page'] == $i ? '###' : $link.$i}">{$i}</a>
        			        </li>
				        <?php } ?>
				        <li class="disabled"><span>...</span></li>
				        <?php for($i = ($list['current_page'] - $side + 1); $i < ($list['current_page'] + $side); $i++) { ?>
    				        <li class="page-item {$list['current_page'] == $i ? 'disabled active' : ''}">
        			            <a class="page-link" href="{$list['current_page'] == $i ? '###' : $link.$i}">{$i}</a>
        			        </li>
				        <?php } ?>
			            <li class="disabled"><span>...</span></li>
			            <?php for ($i = ($list['last_page'] - 1); $i <= $list['last_page']; $i ++) { ?>
		    		        <li class="page-item {$list['current_page'] == $i ? 'disabled active' : ''}">
    		    	            <a class="page-link" href="{$list['current_page'] == $i ? '###' : $link.$i}">{$i}</a>
    			            </li>
				        <?php } ?>
				    <?php } ?> 
			        <li class="page-item {$list['current_page'] == $list['last_page'] ? 'disabled active': ''}">
			            <a class="page-link" href="{$list['current_page'] == $list['last_page'] ? '###' : $link.($list['current_page']+1)}">»</a>
		            </li>
			    </div>
			    <?php } ?>
			</div>
		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
</body>
</html>